import Vue from 'vue'
import App from './App.vue'
import router from './router'
//导入字体样式
import './assets/fonts/iconfont.css'
import '@/assets/css/element-variables.scss'
import '@/assets/css/style.scss'


// 引入自定义主题
import '@/assets/css/theme.scss'
//import installElementPlus from './plugins/element'
//导入全局样式表
import './assets/css/global.css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import TreeTable from 'vue-table-with-tree-grid'
//导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
//导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
//vuex
import Vuex from 'vuex'
import store from './store/store.js'
//高德地图
import VueAMap from 'vue-amap'
Vue.use(VueAMap);
// 初始化vue-amap
VueAMap.initAMapApiLoader({
    key: 'c212135596939f16bff855649bad7c0b', // 高德的key
    // 插件集合
    plugin: [
        'AMap.CircleEditor', // 圆形编辑器插件
        "AMap.Geolocation", // 定位控件，用来获取和展示用户主机所在的经纬度位置
        "AMap.Geocoder", // 地理编码与逆地理编码服务，用于地址描述与坐标间的相互转换
        "AMap.Autocomplete",
        "AMap.PlaceSearch",
        "AMap.CitySearch",
    ],
    // 高德 sdk 版本，默认为 1.4.4
    v: '1.4.4'
});
//高德的安全密钥
window._AMapSecurityConfig = {
    securityJsCode: '5df1f61cdd50cdee2f2358d3ef13c5e3',
}

//配置请求的根路径
axios.defaults.baseURL = 'http://localhost:8787'
axios.interceptors.request.use(config => {
    console.log(config);
    config.headers.Authorization = window.sessionStorage.getItem('token')
        //在最后必须 return config
    return config
})
Vue.prototype.$http = axios;
Vue.use(Vuex);
Vue.use(ElementUI);
//将富文本编辑器注册为全局可用的组件
Vue.use(VueQuillEditor);

Vue.component('tree-table', TreeTable)
Vue.config.productionTip = false
Vue.filter('dateFormat', function(originVal) {
    const dt = new Date(originVal)
    const y = dt.getFullYear()
    const m = (dt.getMonth() + 1 + '').padStart(2, '0')
    const d = (dt.getDate() + '').padStart(2, '0')
    const hh = (dt.getHours() + '').padStart(2, '0')
    const mm = (dt.getMinutes() + '').padStart(2, '0')
    const ss = (dt.getSeconds() + '').padStart(2, '0')
    return y + '-' + m + '-' + d + ' ' + hh + ':' + mm + ':' + ss
})
new Vue({
    store,
    router,
    render: h => h(App)
}).$mount('#app')